/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from './upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasOperatorLevel extends BasicModel<BasOperatorLevel> {
  code?: string; // 操作工编码
  invCode?: string; // 存货编码
  operCode?: string; // 工序编码
  techLevel?: string; // 当前等级
  justDate?: string; // 等级调整日期
}

export const basOperatorLevelList = (params?: BasOperatorLevel | any) =>
  defHttp.get<BasOperatorLevel>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/list',
    params,
  });

export const basOperatorLevelListData = (params?: BasOperatorLevel | any) =>
  defHttp.post<Page<BasOperatorLevel>>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/listData',
    params,
  });

export const basOperatorLevelForm = (params?: BasOperatorLevel | any) =>
  defHttp.get<BasOperatorLevel>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/form',
    params,
  });

export const basOperatorLevelSave = (params?: any, data?: BasOperatorLevel | any) =>
  defHttp.postJson<BasOperatorLevel>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/save',
    params,
    data,
  });

export const basOperatorLevelDisable = (params?: BasOperatorLevel | any) =>
  defHttp.get<BasOperatorLevel>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/disable',
    params,
  });

export const basOperatorLevelEnable = (params?: BasOperatorLevel | any) =>
  defHttp.get<BasOperatorLevel>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/enable',
    params,
  });

export const basOperatorLevelDelete = (params?: BasOperatorLevel | any) =>
  defHttp.get<BasOperatorLevel>({
    url: adminPath + '/bas/mes/level/basOperatorLevel/delete',
    params,
  });

export const basOperatorLevelImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/mes/level/basOperatorLevel/importData',
      onUploadProgress,
    },
    params,
  );
